using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class t_ItemPropDescMap : EntityTypeConfiguration<t_ItemPropDesc>
    {
        public t_ItemPropDescMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FItemClassID, t.FPropID, t.FBrNo });

            // Properties
            this.Property(t => t.FItemClassID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FPropID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FName)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FName_Cht)
                .HasMaxLength(255);

            this.Property(t => t.FName_en)
                .HasMaxLength(255);

            this.Property(t => t.FSQLColumnName)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.FBehavior)
                .HasMaxLength(10);

            this.Property(t => t.FBrNo)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.FAction)
                .HasMaxLength(100);

            this.Property(t => t.FSaveRule)
                .HasMaxLength(100);

            this.Property(t => t.FDefaultValue)
                .HasMaxLength(20);

            this.Property(t => t.FSrcTable)
                .HasMaxLength(80);

            this.Property(t => t.FSrcField)
                .HasMaxLength(80);

            this.Property(t => t.FDisplayField)
                .HasMaxLength(50);

            this.Property(t => t.FPageName)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FPageName_Cht)
                .HasMaxLength(255);

            this.Property(t => t.FPageName_en)
                .HasMaxLength(255);

            this.Property(t => t.FComCall)
                .HasMaxLength(100);

            this.Property(t => t.FModifyTime)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(8)
                .IsRowVersion();

            // Table & Column Mappings
            this.ToTable("t_ItemPropDesc");
            this.Property(t => t.FItemClassID).HasColumnName("FItemClassID");
            this.Property(t => t.FPropID).HasColumnName("FPropID");
            this.Property(t => t.FName).HasColumnName("FName");
            this.Property(t => t.FName_Cht).HasColumnName("FName_Cht");
            this.Property(t => t.FName_en).HasColumnName("FName_en");
            this.Property(t => t.FSQLColumnName).HasColumnName("FSQLColumnName");
            this.Property(t => t.FDataType).HasColumnName("FDataType");
            this.Property(t => t.FPrecision).HasColumnName("FPrecision");
            this.Property(t => t.FScale).HasColumnName("FScale");
            this.Property(t => t.FActualType).HasColumnName("FActualType");
            this.Property(t => t.FActualSize).HasColumnName("FActualSize");
            this.Property(t => t.FBehavior).HasColumnName("FBehavior");
            this.Property(t => t.FBrNo).HasColumnName("FBrNo");
            this.Property(t => t.FSearch).HasColumnName("FSearch");
            this.Property(t => t.FAction).HasColumnName("FAction");
            this.Property(t => t.FSaveRule).HasColumnName("FSaveRule");
            this.Property(t => t.FDefaultValue).HasColumnName("FDefaultValue");
            this.Property(t => t.FSrcTable).HasColumnName("FSrcTable");
            this.Property(t => t.FSrcField).HasColumnName("FSrcField");
            this.Property(t => t.FDisplayField).HasColumnName("FDisplayField");
            this.Property(t => t.FViewMask).HasColumnName("FViewMask");
            this.Property(t => t.FFilterField).HasColumnName("FFilterField");
            this.Property(t => t.FPageName).HasColumnName("FPageName");
            this.Property(t => t.FPageName_Cht).HasColumnName("FPageName_Cht");
            this.Property(t => t.FPageName_en).HasColumnName("FPageName_en");
            this.Property(t => t.FComCall).HasColumnName("FComCall");
            this.Property(t => t.FIsShownList).HasColumnName("FIsShownList");
            this.Property(t => t.FIsInput).HasColumnName("FIsInput");
            this.Property(t => t.FIsDisplay).HasColumnName("FIsDisplay");
            this.Property(t => t.FModifyTime).HasColumnName("FModifyTime");
            this.Property(t => t.FOrder).HasColumnName("FOrder");
        }
    }
}
